package com.yang.library.bookenum;

public enum Role {
    ADMIN("admin"), USER("user");
    final String value;

    Role(String role) {
        this.value = role;
    }

    public static Role fromString(String value) {
        if (value == null) throw new IllegalArgumentException("Value cannot be null");
        for (Role role : values()) {
            if (role.name().equalsIgnoreCase(value)) {
                return role;
            }
        }
        throw new IllegalArgumentException("No matching constant for [" + value + "]");
    }
}
